<%  if (controller.action_name == 'new' ) or (controller.action_name ==  'create')  %>
     <%= form_remote_tag (:update => 'div_list',
                          :complete => "new Effect.Highlight('tbl',{duration: 1.5})",
                          :url    => {:action => 'create'} )%>   

<%  elsif (controller.action_name == 'edit' ) or (controller.action_name ==  'update') %>
     <%= form_remote_tag (:update => 'div_list',
                          :complete => "new Effect.Highlight('datarow#{@entry.id.to_s}',{duration: 1.5})",
                          :url    => {:action => 'update', :id => @entry} )%>
<%  end %>
<table cellpadding="2" cellspacing="0" border="1" id="tbl">
    <tr class="ListTitle">
        <td>
            Date/Time
        </td>
        <td>
            Rel Time
        </td>
        <td>
            Category
        </td>
        <td>
            Entry Type
        </td>
        <td>
            Entry Value
        </td>
        <td>
            Notes
        </td>
        <td>
            Actions
        </td>
    </tr>
    <tr class="LineEntry">
        <td>
            <!--[form:entry]-->
            <font size="1"><%= text_field 'entry', 'occured_at', :size => '14' %></font></p>
        </td>
        <td>
            <%= collection_select( :entry, :timequaltype_id, Timequaltype.find_all, :id, :timequaltype) %>
        </td>
        <td>
            <%= collection_select( :entry, :entrytype_id, Entrytype.find_all, :id, :entrytype)  %>
        </td>
        
        <%= observe_field "entry_entrytype_id", 
                 {:url => {:action => 'filter_entrysubtypes'},
                  :with => "entry_entrytype_id"} %>
        
        <td>
            <%= collection_select( :entry, :entrysubtype_id, @entrysubtypes, :id, :entrysubtype)  %>
        </td>
        <td>
            <%= text_field 'entry', 'entryvalue', {:maxlength => 5}  %>
        </td>
        <td>
            <%= text_area 'entry', 'notes', {:rows => 1, :maxlength => 25 , :cols => 25, :class => "cell_text"}  %>
            <!--[eoform:entry]-->
        </td>
        <td>
            <%= submit_tag "Create" %>
        </td>
    </tr>

<script type="text/javascript">
    Calendar.setup({
        inputField     :    'entry_occured_at',     // id of the input field
        ifFormat       :    "%Y-%m-%d %H:%M:%S",     // format of the input field (even if hidden, this format will be honored)
        daFormat       :    "%Y-%m-%d %H:%M:%S",// format of the displayed date
        showsTime      :    true,
        timeFormat     :    "24",
        align          :    "Tl",           // alignment (defaults to "Bl")
        singleClick    :    true
    });
</script>
<%= end_form_tag %>

